{layout name="passport:layout" /}
<div class="titlebar">
    <div class="fn-left">
        <button class="button button-blue bar" url="{:url('system/passport.message/delete')}" msg="【删除】确定要删除已选消息" issale="0"><i class="iconfont icon-lajixiang"></i>删除</button>
    </div>    
    <div class="fn-right button-group">
        <a href="{:url('system/passport.message/index',['type' => 0])}" class="button {$type == 0 ?'button-green':''}">全部消息</a>
        <a href="{:url('system/passport.message/index',['type' => 1])}" class="button {$type == 1 ?'button-green':''}">未阅读</a>
        <a href="{:url('system/passport.message/index',['type' => 2])}" class="button {$type == 2 ?'button-green':''}">已阅读</a>
    </div>
</div>
<table class="table table-border">
    <thead>
        <tr>
            <th class="w40 fn-tac"><input type="checkbox" onclick="CheckAll(this)"></th>
            <th>消息内容</th>
            <th class="w140 fn-tac">创建时间</th>
            <th class="w60 fn-tac">状态</th>
        </tr>
    </thead>
    <tbody>
        {foreach $list as $vo}
        <tr>
            <td class="fn-tac"><input name="ids[]" type="checkbox" value="{$vo.id}"></td>
            <td><a class="jump" href="javascript:;" title="查看" url="{$vo.url}" attr="{$vo['id']}">{$vo.message}</a></td>
            <td class="fn-tac">{$vo->create_time|date='Y-m-d H:i'}</td>
            <td class="fn-tac">{if $vo.is_read}<span class="badge">已读</span>{else}<span class="badge bg-red">未读</span>{/if}</td>
        </tr>
        {/foreach}
    </tbody>
</table>
<div class="page">{$list|raw}</div>
<script type="text/javascript">
Do('base','layer','tip',function(){
    $(".bar").click(function() {
        var url = $(this).attr('url');
        var issale = $(this).attr('issale');
        var msg = $(this).attr('msg');
        tools_submit({action:url,msg:msg})
    })
    $('.jump').click(function () {
        var url = $(this).attr("url");
        var id = $(this).attr("attr");
        $.getJSON("{:url('system/passport.message/clean')}?id="+id, function (rel) {
            if(rel.code == 200){
                $(location).attr('href',url);
            }else{
                parent.layer.alert(rel.msg);
            }
        });
    })
})
</script>